#include "nixie.h"

unsigned char xiabiao[9] = {0,20,20,20,20,20,20,20,20};
unsigned char code NixieTable[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,0xff,0xbf};

void Nixie(unsigned char location,unsigned char number)
{
	Latch(NIXIE_D,0xff);
	switch(location)
	{
		case 1:Latch(NIXIE_W,0x01);break;
		case 2:Latch(NIXIE_W,0x02);break;
		case 3:Latch(NIXIE_W,0x04);break;
		case 4:Latch(NIXIE_W,0x08);break;
		case 5:Latch(NIXIE_W,0x10);break;
		case 6:Latch(NIXIE_W,0x20);break;
		case 7:Latch(NIXIE_W,0x40);break;
		case 8:Latch(NIXIE_W,0x80);break;
	}
		
	Latch(NIXIE_D,NixieTable[number]);
}

void N_loop()
{
	static unsigned char i = 1;
	Nixie(i,xiabiao[i]);
	i++;
	if(i==9)
	i = 1;
}

void Nixie_show(unsigned char location,unsigned char number)
{
	xiabiao[location] = number;
}	